<template>
	<view class="all">
		<view class="carp" :style="{
		'border-top':index==0?'1rpx solid #EFEFEF':'',
		'border-bottom':index!=list.length-1?'1rpx solid #EFEFEF':'1rpx solid #EFEFEF'
		}" @click="submit(item)" v-for="(item,index) in list">
			<text class="text_1">{{item.name}}</text>
			<view class="carp_1">
				<text v-if="item.text" :style="{
					'color':item.color?item.color:'#999999',
					'font-size':item.size?item.size+'rpx':'26rpx'
				}">{{item.text}}</text>
				<u-icon name="arrow-right" size="25" color='#91969A ' />
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			var str = '1366668888';
			var str2 = str.substr(0, 3) + "****" + str.substr(7);
			return {
				info: {},
				str: '',
				list: [{
						name: "手机号",
						text: '',
						color: '#333333',
						size: '30'
					},
					{
						name: "微信号",
						text: '已经绑定',
						color: '#FFB300',
						size: '30'
					},
					{
						name: "支付密码",
						text: ''
					},

				]
			}
		},
		onLoad() {
			this.getinfo()
		},
		methods: {
			getinfo() {
				this.$api('userMsg/accountSecurity').then(res => {
					this.info = res.data
					this.list.forEach(v => {
						if (v.name == '手机号') {
							let str = this.info.mobile
							v.text = this.info.mobile.substr(0, 3) + "****" + this.info.mobile.substr(7);
						}
						if (v.name == '微信号') {
							if (this.info.is_binding == 0) {
								v.text = '绑定微信'
							} else {
								v.text = '已经绑定'
							}
						}
					})
				})
			},
			submit(a) {
				switch (a.name) {
					case '手机号':
						uni.navigateTo({
							url: `./anquan?data=${JSON.stringify(a)}`
						})
						break;
					case '支付密码':
						uni.navigateTo({
							url: `./anquan?data=${JSON.stringify(a)}`
						})
						break;
					default:
				}
			}
		}
	}
</script>

<style lang="scss">
	.all {
		padding: 30rpx;

		.carp:active {
			background-color: rgba($color: #999999, $alpha: 0.1);
		}

		.carp {
			padding: 35rpx 0 35rpx 0;
			display: flex;
			justify-content: space-between;

			.carp_1 {
				text {
					font-size: 26rpx;
					font-family: Source Han Sans CN;
					color: #999999;
					margin-right: 10rpx;
					opacity: 1;
				}
			}

			.text_1 {
				font-size: 30rpx;
				font-family: Source Han Sans CN;
				color: #333333;
				font-weight: 600;
				opacity: 1;
			}
		}
	}
</style>
